#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

int dominantIndex(int* nums, int numsSize) {
    int max = *nums;
    int i = 0;
    int count = 0;
    for (i = 1; i < numsSize; i++)
    {
        if (max < *(nums + i))
        {
            max = *(nums + i);
            count = i;
        }
    }
    for (i = 0; i < numsSize; i++)
    {
        if (i == count)
            continue;
        if (*(nums + i) * 2 > max)
        {
            count = -1;
            break;
        }
    }
    return count;
}

int main()
{
    int arr[] = { 3,6,1,0 };
    int sz = sizeof(arr) / sizeof(arr[0]);
    int n = dominantIndex(arr, sz);
    printf("%d", n);
    return 0;
}